# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer:
pkgname=idris2-stage0
pkgver=0.5.1
pkgrel=1
pkgdesc="Idris 2 version used to bootstrap the Idris 2 compiler"
url="https://www.idris-lang.org"
arch="x86 x86_64" # limited by chez-scheme
license="BSD-3-Clause"
depends="chez-scheme gmp-dev"
makedepends="bash"
source="https://github.com/idris-lang/Idris2/archive/v$pkgver/idris2-$pkgver.tar.gz"
builddir="$srcdir/Idris2-$pkgver"

# Provide idris2-bootstrap for testing/idris2.
# See the comment in testing/idris2 for more information.
provides="idris2-bootstrap"
provider_priority=1 # lowest

case "$CARCH" in
x86) options="!check" ;; # XXX: https://github.com/idris-lang/Idris2/issues/1617
esac

build() {
	# Bootstrap Idris 2 compiler from scheme sources.
	make -j1 bootstrap PREFIX=/usr SCHEME=chez
}

check() {
	make -j1 bootstrap-test
}

package() {
	# Idris2 Makefile doesn't honor ${DESTDIR}
	# See https://github.com/idris-lang/Idris2/pull/1123
	make IDRIS2_PREFIX="$pkgdir/usr" \
		PREFIX="$pkgdir/usr" install
}

sha512sums="
6b4a4092570136a684bdd80765d271bc1ebe163c273ff22d22c808f586183a8e90a326573dd0e4b339e1ab0b88fd31f1cc7bf2820ff7bab2742c4156b816c5b7  idris2-0.5.1.tar.gz
"
